package com.byl.modules.core.controller.web;

import com.byl.common.modules.controller.BaseController;
import com.byl.modules.core.bean.CustomerBean;
import com.byl.modules.core.service.CustomerService;
import com.byl.sdk.bean.ResultBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;


@RestController
@RequestMapping("/wx/customer")
public class WxCustomerController extends BaseController {

    @Autowired
    CustomerService customerService;

    @PostMapping("/apply")
    public  String save(@RequestBody CustomerBean customerBean){
        int rs=customerService.save(customerBean);
        if(rs==1){
            return success("申请成功，请等待工作人员联系！");
        }
        return fail("申请失败，请稍后再试！");

    }
    @PostMapping("/query")
    public String query(@RequestBody Map map){
        ResultBean bean=customerService.query(map);
        return success("客户列表",bean);
    }

    @PostMapping("/receive")
    public String receive(@RequestBody Map map){
        int rs=customerService.receive(map);
        return rs==1?success("领取成功"):fail("领取失败");

    }
}
